//
//  MainViewSection.m
//  XRmenu-HD
//
//  Created by shengchao yang on 11-12-12.
//  Copyright (c) 2011年 home user. All rights reserved.
//

#import "MainViewSection.h"

@implementation MainViewSection
@synthesize delegate;
-(id) initWithStyle:(NSString*)stylename DishSubViewName:(NSString*)vname
{
    self = [super initWithStyle:stylename DishSubViewName:vname];
    if (self) {
        [self add1fingerTap];
    }
    return self;
}
//初始化数据
-(void) setData:(NSString *)_sortName leftOrDown:(BOOL) isDown{
    //用label显示小类名称
    if ([self viewWithTag:kTagOfStartLabel]) {
        UILabel *tl = (UILabel*)[self viewWithTag:kTagOfStartLabel];
        [tl setText:JsonFiled(_sortName)];
    }
    UIImage *image;
    if (isDown) {
        NSString *imgname = [XRmenuPublic getGeneralSkinImg:@"MainView/bt_tableview_section_down.png"];
        image =[UIImage imageWithContentsOfFile:imgname];
    }
    else{
        NSString *imgname = [XRmenuPublic getGeneralSkinImg:@"MainView/bt_tableview_section_right.png"];
        image =[UIImage imageWithContentsOfFile:imgname];
    }
    
    //用button显示箭头方向
    if ([self viewWithTag:kTagOfStartBT]) {
        UIButton *btn = (UIButton*)[self viewWithTag:kTagOfStartBT];
        [btn setImage:image forState:UIControlStateNormal];
    }
}
//单击事件，调用MainView里的委托
- (void)handleTapFrom:(UITapGestureRecognizer *)recognizer {
    [self.delegate sectionHeaderClicked:self HeadTag:self.tag];
}

@end
